$(function(){
	//顶部导航下拉
	$(".topnav ul li").hover(function(){
		$(this).find(".topnav_down").show();
	},function(){
		$(this).find(".topnav_down").hide();
	});
	
	//右侧图标导航
	$(".qqright_li").hover(function(){
		$(this).find(".qqrdown, .qqrdown2").show();
	},function(){
		$(this).find(".qqrdown, .qqrdown2").hide();
	});
	
	//底部客服
	$(".index_kefu_fr p").click(function(){
		$(".index_kefu").hide();
		$(".index_kefuico").show();
        $.ajax({
            type : "get",
            dataType:'json',
            url:"/index.php?m=Home&c=Index&a=set_kf_cookie&kf_hide=1",

        });
	});
	$(".index_kefuico").click(function(){
		$(".index_kefu").show();
		$(".index_kefuico").hide();
        $.ajax({
            type : "get",
            dataType:'json',
            url:"/index.php?m=Home&c=Index&a=set_kf_cookie&kf_hide=0",

        });
	});
});

//注册协议
function reg_xieyi(ifbtn)
{


	
	protocol = ""
	
	$.ajax({
	type:"post",
	url:"/Home/index/protocol.html",
	data:{"name":"test","id":"11"},
	dataType:"json",
	
	success:function(data)
	{
		html = '<div class="reg_xieyi_box">';
		html += '<div class="reg_xieyi_tit">朋伴网络服务使用协议</div>';
		html += '<div class="reg_xieyi_con"><div class="wrapper">';
		
		protocol = data.msg;
		protocol = HTMLDecode(protocol);
		html += protocol;
		
		<!----------------------------->
		html += '</div></div>';
		html += '<div class="reg_xieyi_btn"><button class="reg_btn reg_bqx" type="button" onclick="reg_close('+ifbtn+')">取消</button><button class="reg_btn reg_bjs" type="button" onclick="reg_ok('+ifbtn+')">同意</button></div>';
		html += '</div>';
		layer.open({
			type: 1,
			title: false,
			area: ['900px', '640px'], //宽高
			shadeClose: true, //开启遮罩关闭
			content: html
		});
	}
	});
}

function HTMLDecode(text) { 
var temp = document.createElement("div"); 
temp.innerHTML = text; 
var output = temp.innerText || temp.textContent; 
temp = null; 
return output; 
}


function reg_close(ifbtn)
{
	if(ifbtn)
	{
		document.getElementById("ifaggree").checked=false;
	}
	layer.closeAll();
}

function reg_ok(ifbtn)
{
	if(ifbtn)
	{
		document.getElementById("ifaggree").checked=true;
	}
	layer.closeAll();
}

//选中checkbox
function gchecked(o,val,divid)
{
	$(o).addClass("gcheckbox_on").siblings().removeClass("gcheckbox_on");
	invalue(val,divid);
}

//赋值函数
function invalue(val,divid)
{
	$(divid).val(val);
}